package com.sdp.wx.db.wx_repair_must_wz.service.impl;

import com.sdp.core.bizc.db.IViewQuery;
import com.sdp.wx.db.wx_repair_must_wz.entity.WxRepairMustWz;
import com.sdp.wx.db.wx_repair_must_wz.mapper.WxRepairMustWzMapper;
import com.sdp.wx.db.wx_repair_must_wz.service.IWxRepairMustWzService;
import com.sdp.wx.view.WxRepairMustWzView;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zsp
 * @since 2024-02-19
 */
@Service
public class WxRepairMustWzServiceImpl extends ServiceImpl<WxRepairMustWzMapper, WxRepairMustWz> implements IWxRepairMustWzService,IViewQuery{

	@Autowired
	private WxRepairMustWzMapper wxRepairMustWzMapper;
	
	@Override
	public <T> List<T> viewList(QueryWrapper<T> queryWrapper) {
		return wxRepairMustWzMapper.viewList(queryWrapper);
	}

	@Override
	public <T> int viewCount(QueryWrapper<T> queryWrapper) {
		return wxRepairMustWzMapper.viewCount(queryWrapper);
	}

	@Override
	public <T> IPage<T> viewPage(IPage<T> page, QueryWrapper<T> queryWrapper) {
		return wxRepairMustWzMapper.viewPage(page, queryWrapper);
	}

	@Override
	public List<WxRepairMustWz> queryRepairMustWzByRepairTypeAndVehicleModel(String repairType, String vehicleModel) {
		LambdaQueryWrapper<WxRepairMustWz> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(WxRepairMustWz::getRepairType, repairType);
		queryWrapper.eq(WxRepairMustWz::getVehicleModel, vehicleModel);
		return list(queryWrapper);
	}

	@Override
	public List<WxRepairMustWzView> queryRepairMustWzViewByRepairTypeAndVehicleModel(String repairType,
			String vehicleModel) {
		QueryWrapper<WxRepairMustWzView> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("a.repair_type", repairType);
		queryWrapper.eq("a.vehicle_model", vehicleModel);
		return wxRepairMustWzMapper.viewList(queryWrapper);
	}

}
